1. Technical Field
The present invention generally relates to allocating task objects. More particularly, the present invention relates to reusing previous task objects and associated resources for new tasks.
2. Background Information
SCSI (Small Computer System Interface) is a set of standards to provide interoperability between conforming systems, primarily between storage devices and client hosts. Compliant client hosts are called SCSI initiators and compliant storage servers are called SCSI targets. SCSI devices may communicate with each other using various physical links (aka transport protocols)—parallel and serial interfaces, fiber channel links, TCP/IP, etc.
The main path of SCSI operation is performed as follows. A SCSI initiator sends commands (requests) to a SCSI target for execution and once the request is completed, the target returns an appropriate response to the client initiator. SCSI commands and responses may be accompanied with significant amount of data, which, in turn, requires initiators and targets to maintain some memory buffer space to hold this data during processing. Normally, this memory is not contiguous, but organized as a list of memory buffers, called scatter-gather list.
iSCSI is a standard protocol to facilitate SCSI functionality when operating over TCP/IP transport. iSCSI devices, when communicating with each other, create an initiator-target nexus in the form of iSCSI session. One of the most important implementation goals for iSCSI devices is to achieve adequate or better performance comparing to other available SCSI transport protocols.
iSCSI task is an object that is maintained during the life cycle of a single SCSI command in process. It contains the command state data as well as the buffer space (scatter-gather list) allocated for this particular I/O operation. Task object allocation and the corresponding buffer space allocation lay in the critical path of iSCSI command processing and any allocation delay increases response latency and accordingly reduces performance. Normally, upon arrival of a SCSI command, a new task is allocated, initialized, and then the necessary buffer space is allocated using the system memory allocator (possibly from a system object cache). For a number of reasons, it is difficult to expect the system to allocate the necessary buffer space atomically, i.e., without waiting for the system allocator to find and/or prepare the requested amount of space.
Moreover, the buffer space in question is typically DMA-capable to exclude unnecessary memory to memory transfers. As a result, atomic memory allocation may fail simply because the system memory has become too fragmented. Modern operating systems maintain special emergency buffers in order to deal with these situations, but this will not guarantee the buffers to be DMA-capable.
As one skilled in the art will know, DMA (Direct Memory Access) is a capability provided by some computer bus architectures that allows data to be sent directly from a linked storage resource to the memory on the computer's motherboard. This frees the processor from involvement with the data transfer, improving overall system performance.
In the past, one way of addressing the above-noted problem has been to allocate iSCSI tasks from a system object cache (known on many platforms as “slab cache”). However, it is difficult to control complex objects using this cache alone.
Thus, a need exists for a more efficient way of allocating task objects.